/**********************************************************************************
 * Code license:  GNU General Public License v3                                   *
 * Main page:     https://code.google.com/p/library-cross-platform/               *
 * Issue tracker: https://code.google.com/p/library-cross-platform/issues/list    *
***********************************************************************************/

package library.ui;

public abstract class Element
{
  private long            elementID;
  private static long     elementIDCounter = 0;
  
  public static final int ELEMENT_TYPE_BASE           = 1;
  public static final int CHECKBOX_TYPE               = ELEMENT_TYPE_BASE + 1;
  public static final int RADIOBUTTON_TYPE            = ELEMENT_TYPE_BASE + 2;
  public static final int RADIOBUTTON_CONTAINER_TYPE  = ELEMENT_TYPE_BASE + 3;
  public static final int TEXTLABEL_TYPE              = ELEMENT_TYPE_BASE + 4;
  public static final int TEXTEDIT_TYPE               = ELEMENT_TYPE_BASE + 5;
  public static final int SEPARATOR_TYPE              = ELEMENT_TYPE_BASE + 6;
  public static final int ELEMENT_CONTAINER_TYPE      = ELEMENT_TYPE_BASE + 7;
  public static final int TAB_CONTAINER_TYPE          = ELEMENT_TYPE_BASE + 8;
  
  
  protected int           elementType                 = ELEMENT_TYPE_BASE;
  protected String        elementName                 = null;
  
  
  protected Element() {
    elementID = ++elementIDCounter;
  }
  
  protected Element(int type) {
    this();
    setElementType(type);
  }
  
  public void setElementType(int type) {
    elementType = type;
  }
  
  public int getElementType() {
    return elementType;
  }
  
  public void setName(String name) {
    elementName = name;
  }
  
  public String getName() {
    return elementName;
  }
  
  public String toString() {
    return elementName;
  }
  
  public long getElementID() {
    return elementID;
  }
}